<template>
  <div class="goods">
    <page-content
      :contenTableConfig="contenTableConfig"
      pageName="goods"
      @handleNewClick="handleNewClick"
    >
      <template #imgUrl="scope">
        <el-image
          style="width: 60px; height: 80px"
          :src="scope.row.imgUrl"
          :preview-src-list="[scope.row.imgUrl]"
        >
        </el-image>
      </template>
      <template #oldPrice="scope">{{ '￥' + scope.row.oldPrice }}</template>
      <template #newPrice="scope">{{ '￥' + scope.row.newPrice }}</template>
    </page-content>
    <page-madal
      pageName="goods"
      :modalConfig="modalConfig"
      :defualtInfo="defualtInfo"
      ref="pageModalRef"
    ></page-madal>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import pageContent from '../../../../../components/page-content/index'
import pageMadal from '../../../../../components/page-modal/index'
import { contenTableConfig } from './config/content.config'
import { modalConfig } from './config/modal.config'
import { usePageModal } from '../../../../../hooks/usePageModal'
export default defineComponent({
  components: {
    pageContent,
    pageMadal
  },
  name: 'goods',
  setup() {
    // 新建和编辑
    const [pageModalRef, defualtInfo, handleNewClick] = usePageModal()
    return {
      contenTableConfig,
      modalConfig,
      defualtInfo,
      handleNewClick,
      pageModalRef
    }
  }
})
</script>

<style scoped></style>
